using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Collections;

using EntLibEC.Cmn;
using EntLibEC.Info.Online;

namespace EntLibEC.Dac.Online
{
	/// <summary>
	/// Summary description for AdvQuestionCustomerDac.
	/// </summary>
	public class AdvQuestionCustomerDac
	{
		
		public AdvQuestionCustomerDac()
		{
			
		}

		public int Insert(AdvQuestionCustomerInfo oParam)
		{
			string sql = @"INSERT INTO Ent_Adv_Question_Customer
                            (
                             ActivitySysNo, CustomerSysNo, CreateTime
                            )
                            VALUES (
                            @ActivitySysNo, @CustomerSysNo, @CreateTime
                            )";			
			SqlCommand cmd = new SqlCommand(sql);

			SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
			SqlParameter paramActivitySysNo = new SqlParameter("@ActivitySysNo", SqlDbType.Int,4);
			SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int,4);
			SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);

			if ( oParam.SysNo != AppConst.IntNull)
				paramSysNo.Value = oParam.SysNo;
			else
				paramSysNo.Value = System.DBNull.Value;
			if ( oParam.ActivitySysNo != AppConst.IntNull)
				paramActivitySysNo.Value = oParam.ActivitySysNo;
			else
				paramActivitySysNo.Value = System.DBNull.Value;
			if ( oParam.CustomerSysNo != AppConst.IntNull)
				paramCustomerSysNo.Value = oParam.CustomerSysNo;
			else
				paramCustomerSysNo.Value = System.DBNull.Value;
			if ( oParam.CreateTime != AppConst.DateTimeNull)
				paramCreateTime.Value = oParam.CreateTime;
			else
				paramCreateTime.Value = System.DBNull.Value;

			cmd.Parameters.Add(paramSysNo);
			cmd.Parameters.Add(paramActivitySysNo);
			cmd.Parameters.Add(paramCustomerSysNo);
			cmd.Parameters.Add(paramCreateTime);

			return SqlHelper.ExecuteNonQuery(cmd);
		}

	}
}
